package com.baizhi.app;

import com.baizhi.entity.Album;
import com.baizhi.entity.Article;
import com.baizhi.entity.Banner;
import com.baizhi.service.AlbumService;
import com.baizhi.service.ArticleService;
import com.baizhi.service.BannerService;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by 野马 on 2019/6/24.
 * @RestController  = @Controller+@Responsebody
 * 声明当前类为控制器  类中的所有方法  响应都会序列化为json
 */

@RestController
@RequestMapping("/app")
public class AppAll {

    @Autowired
    private BannerService bannerService;
    @Autowired
    private AlbumService albumService;
    @Autowired
    private ArticleService articleService;

    private Logger logger = LoggerFactory.getLogger(AppAll.class);


    /**
     * 轮播图模块
     * @return
     */
    @RequestMapping("selectBannnerAll")
    public List<Banner> selectBannnerAll(){
        return bannerService.selectBannnerAll();
    }

    /**
     * 专辑模块
     * @param type
     * @return
     */

    @RequestMapping("selectAlbumAll")
    public List<Album> selectAlbumAll(String type){
        return albumService.selectAlbum(type);
    }

    @RequestMapping("selectArticleAll")
    public List<Article> selectArticleAll(String articleType){
        logger.info(articleType);
        return articleService.selectArticleAll(articleType);
    }

}
